package com.itlong.cloud.POJO.VO;

import com.itlong.cloud.enumerate.ecode.ErrorCode;
import com.itlong.cloud.utils.node.JsonUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 响应结果格式化
 *
 * @craeteDate 2017--19 16:06
 */
@Data
@NoArgsConstructor
public class SDKMessageVO implements Serializable {

    private Integer msgCode;
    private String msg;
    private String requestId;
    private String timestamp;
    private String sign;
    private Object data = "";


    /** 自定义错误码及数据集的响应结果
     *
     * @param errorCode 错误码
     * @param data 数据集
     */
    public SDKMessageVO(ErrorCode errorCode, String requestId, String timestamp, String sign, Object data){
        super();
        this.setMsgCode(errorCode.getErrorValue());
        this.setMsg(errorCode.getCodeMsg());
        this.setRequestId(requestId);
        this.setTimestamp(timestamp);
        this.setSign(sign);
        this.setData(data);
    }

    /** 自定义错误码响应结果
     * @param errorCode
     * @param errorCode
     */
    public SDKMessageVO(ErrorCode errorCode, String requestId, String timestamp, String sign){
        super();
        this.setMsgCode(errorCode.getErrorValue());
        this.setMsg(errorCode.getCodeMsg());
        this.setRequestId(requestId);
        this.setTimestamp(timestamp);
        this.setSign(sign);
    }

    /** 自定义错误码响应结果
     * @param errorCode
     * @param errorCode
     */
    public SDKMessageVO(ErrorCode errorCode, String msg, String requestId, String timestamp, String sign, Object data){
        super();
        this.setMsgCode(errorCode.getErrorValue());
        this.setMsg(errorCode.getCodeMsg());
        this.setMsg(msg);
        this.setRequestId(requestId);
        this.setTimestamp(timestamp);
        this.setSign(sign);
        this.setData(data);
    }

    /** 自定义错误码响应结果
     * @param errorCode
     * @param errorCode
     */
    public SDKMessageVO(ErrorCode errorCode, String msg, String requestId, String timestamp, String sign){
        super();
        this.setMsgCode(errorCode.getErrorValue());
        this.setMsg(errorCode.getCodeMsg());
        this.setMsg(msg);
        this.setRequestId(requestId);
        this.setTimestamp(timestamp);
        this.setSign(sign);
    }

}
